﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude">
  <Arguments>
    <Argument Name="ProviderName">
      <Converter Type="CodeIdentifierStringConverter"/>
    </Argument>
		<Argument Name="CurrentProject" Type="Project">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />
		</Argument>
		<Argument Name="CurrentFolder" Type="ProjectItem" Required="false" >
			<ValueProvider Type="CurrentItemProvider" />
		</Argument>
		<Argument Name="Namespace">
      <Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
      <ValueProvider Type="Evaluator"  Expression="$(CurrentProject.Properties.Item('DefaultNamespace').Value)" />
    </Argument>
		<Argument Name="ExtendedNamespace" Required="false">
			<ValueProvider Type="Microsoft.Practices.EnterpriseLibrary.BlockFactory.ValueProviders.ExtendedNamespaceValueProvider, Microsoft.Practices.EnterpriseLibrary.BlockFactory"  
									   Folder="CurrentFolder" />
		</Argument>
		<xi:include href="CommonTextTemplate.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:Arguments/gax:Argument)" />
		<xi:include href="CommonAddReferences.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:Arguments/gax:Argument)" />
	</Arguments>
  <GatheringServiceData>
    <Wizard xmlns="http://schemas.microsoft.com/pag/gax-wizards" SchemaVersion="1.0">
      <Pages>
        <Page>
          <Title>New Provider</Title>
					<LinkTitle>New Provider</LinkTitle>
					<Help></Help>
					<Fields>
            <Field Label="Name" ValueName="ProviderName" >
              <Tooltip>Specifies the name for the new Provider</Tooltip>
            </Field>
          </Fields>
        </Page>
      </Pages>
    </Wizard>
  </GatheringServiceData>
  <Actions>
    <Action Name="GenerateDefaultRuntimeImplementationContent" 
       Type="TextTemplateAction">
      <Input Name="Template" ActionOutput="CreateProviderInfo.DefaultRuntimeImplementationTemplate"/>
      <Input Name="ProviderInfo" ActionOutput="CreateProviderInfo.ProviderInfo"/>
      <Output Name="Content" />
    </Action>
    <Action Name="GenerateProviderContent" 
       Type="TextTemplateAction"
       Template="$TextTemplateBaseDirectory$Provider.t4"
 			 DynamicTemplate="$DynamicProviderTemplate$"
			 >
      <Input Name="ProviderInfo" ActionOutput="CreateProviderInfo.ProviderInfo"/>
      <Input Name="DefaultRuntimeImplementation" ActionOutput="GenerateDefaultRuntimeImplementationContent.Content"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddProvider" 
			  Type="AddItemFromStringActionPromptingExistence" 
			  Open="true"  PromptForOverwriting="true" 
				TargetFileName="$ProviderName$.$LanguageFileExtension$">
			<Input Name="Item" RecipeArgument="CurrentFolder" />
			<Input Name="Content" ActionOutput="GenerateProviderContent.Content" />
			<Input Name="Project" RecipeArgument="CurrentProject" />
      <Output Name="ProjectItem"/>
    </Action>
    <Action Name="GenerateProviderDataContent" 
       Type="TextTemplateAction"
       Template="$TextTemplateBaseDirectory$ProviderData.t4"
			 DynamicTemplate="$DynamicProviderDataTemplate$"
			 >
      <Input Name="ProviderInfo" ActionOutput="CreateProviderInfo.ProviderInfo"/>
      <Output Name="Content" />
    </Action>
    <Action Name="AddProviderData" 
			  Type="AddItemFromStringActionPromptingExistence" 
			  Open="true"  PromptForOverwriting="true" ItemName="Configuration"  
				TargetFileName="$ProviderName$Data.$LanguageFileExtension$">
      <Input Name="Content" ActionOutput="GenerateProviderDataContent.Content" />
      <Input Name="Project" RecipeArgument="CurrentProject" />
      <Output Name="ProjectItem"/>
    </Action>
		<xi:include href="CommonAddReferences.xml"
			xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Recipe/gax:Actions/gax:Action)" />
		<xi:include href="CommonTodoComments.xml"
			xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Recipe/gax:Actions/gax:Action)" />
	</Actions>
</Recipe>